//
//  GiftTableViewCell.m
//  悠狸
//
//  Created by dlios on 15-8-26.
//  Copyright (c) 2015年 Dung. All rights reserved.
//

#import "GiftTableViewCell.h"
#import "UIImageView+WebCache.h"
#import "CateModel.h"
#import "MyModel.h"
@interface GiftTableViewCell()

@property (nonatomic, retain)UIImageView *imageV;
@property (nonatomic, retain)UILabel *likes_count;
@property (nonatomic, retain)UILabel *title;
@end


@implementation GiftTableViewCell

- (void)dealloc
{
    [_imageV release];
    [_likes_count release];
    [_title release];
    [super dealloc];
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        [self create];
    }
    return self;
    
}

- (void)create
{
    
    _imageV = [[UIImageView alloc] initWithFrame:CGRectMake(15 *OffWidth, 15 *OffHeight, 345 *OffWidth, 175*OffHeight)];
    
    [self.contentView addSubview:_imageV];
    
    self.title = [[[UILabel alloc] initWithFrame:CGRectMake(20*OffWidth, 110*OffHeight, 300*OffWidth,60*OffHeight )] autorelease];
    _title.numberOfLines = 0;
    _title.textColor = [UIColor whiteColor];
    [self.imageV addSubview:_title];
    
    NSString *path1 = [[NSBundle mainBundle] pathForResource:@"6" ofType:@"png"];
    UIImage *image = [UIImage imageNamed:path1];
    UIImageView *imageA = [[[UIImageView alloc] initWithFrame:CGRectMake(240*OffWidth, 15*OffHeight, 30*OffWidth, 30*OffHeight)] autorelease];
    imageA.image =image;
    
    [self.imageV addSubview:imageA];
    
    
    self.likes_count =[[[UILabel alloc] initWithFrame:CGRectMake(270*OffWidth, 15*OffHeight, 60*OffWidth, 30*OffHeight)] autorelease];
    [self.imageV addSubview:_likes_count];

    
    
}
- (void)setmodel:(MyModel *)model
{
    [_imageV sd_setImageWithURL:[NSURL URLWithString:model.cover_image_url] placeholderImage:[UIImage imageNamed:@"000.jpg"]];
    _likes_count.text = [NSString stringWithFormat:@"%@", model.likes_count] ;
    _title.text = model.title;
 
}
- (void)setCate:(CateModel *)model
{
    [_imageV sd_setImageWithURL:[NSURL URLWithString:model.cover_image_url] placeholderImage:[UIImage imageNamed:@"000.jpg"]];
    _likes_count.text = [NSString stringWithFormat:@"%@", model.likes_count] ;
    _title.text = model.title;
}
- (void)setLunbotu:(MyModel *)model
{
    [_imageV sd_setImageWithURL:[NSURL URLWithString:model.cover_image_url] placeholderImage:[UIImage imageNamed:@"000.jpg"]];
    _likes_count.text = [NSString stringWithFormat:@"%@", model.likes_count] ;
    _title.text = model.title;
}
@end
